<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vuejs/vue.js"></script>
</head>
<body>
    <div id="root">
        <h2>欢迎来到{{name}}</h2>
        <!-- <button v-on:click="showInfo">点我提升信息2</button>
        <button @click="showInfo2($event,66)">点我提升信息2</button> -->
        <input type="text" placeholder="按下回车键提示输入" @keyup.enter="showInfo">
        <input type="text" placeholder="按下回车键提示输入" @keyup.ctrl.y="showInfo">
    </div>
    <script>
        Vue.config.productionTip=false;
        Vue.config.keyCodes.huiche=13;//自定义键名
        const vm=new Vue({
            el:"#root",
            data:{
                name:'新世界'
            },
            methods:{
                showInfo(event){
                    // console.log(event);
                    // console.log(event.target);
                    // console.log(this);//此处的this是vm
                    // alert('你好1')
                    console.log(event.key,event.keyCode);
                    console.log(event.target.value)
                },
                showInfo2(event,number){
                    // console.log(event);
                    // console.log(event.target);
                    console.log(this,number);//此处的this是vm
                    // alert('你好2')
                }
            }
        })
    </script>
</body>
</html>